<template>
  <el-dialog :title="ActTitle" :visible.sync="openAct" :close-on-click-modal="false" width="1000px" append-to-body
    :show-close="false" v-dialogDrag>
    <!-- 工况点(理论) -->
    <div v-if="ActTitle == '工况点（理论）'">
      <el-table :key="ActProps" :data="form.tworkingConditionTheoreticalList" border max-height="600">
        <el-table-column label="	工况名称" align="center" prop="conditionName" min-width="150" show-overflow-tooltip />
        <el-table-column label="进口态流量 m3/min" align="center" prop="inletVolumeM3Min" min-width="150"
          show-overflow-tooltip />
        <el-table-column label="标态流量 Nm3/min" align="center" prop="standardVolumeNm3Min" min-width="150"
          show-overflow-tooltip />
        <el-table-column label="进气法兰处压力 pj bar(a)" align="center" prop="inletPressurePjBar" min-width="200"
          show-overflow-tooltip />
        <el-table-column label="进气温度 Tj ℃" align="center" prop="inletTemperatureTj" min-width="150"
          show-overflow-tooltip />
        <el-table-column label="相对湿度 %" align="center" prop="humidityPercent" min-width="150" show-overflow-tooltip />
        <el-table-column label="排气法兰处压力 bar(a)" align="center" prop="outletPressureBar" min-width="200"
          show-overflow-tooltip />
        <el-table-column label="排气温度 ℃" align="center" prop="outletTemperature" min-width="150" show-overflow-tooltip />
        <el-table-column label="	静叶角度 °" align="center" prop="statorBladeAngle" min-width="150" show-overflow-tooltip />
        <el-table-column label="多变效率 %" align="center" prop="polytropicEfficiency" min-width="150"
          show-overflow-tooltip />
        <el-table-column label="内功率 kW" align="center" prop="internalPowerKw" min-width="150" show-overflow-tooltip />
        <el-table-column label="工作转速 r/min" align="center" prop="rotationSpeedRpm" min-width="150"
          show-overflow-tooltip />
      </el-table>
    </div>
    <div v-if="ActTitle == '工况点（实际）'">
      <!--  工况点(实际)  -->
      <el-table :key="ActProps" :data="form.tworkingConditionActualList" border max-height="600">
        <el-table-column label="时间点" align="center" prop="conditionName" min-width="150" show-overflow-tooltip />
        <el-table-column label="标态流量 Nm3/min" align="center" prop="standardVolumeNm3Min" min-width="150"
          show-overflow-tooltip />
        <el-table-column label="进气法兰处压力 pj bar(a)" align="center" prop="inletPressurePjBar" min-width="200"
          show-overflow-tooltip />
        <el-table-column label="进气温度 Tj ℃" align="center" prop="inletTemperatureTj" min-width="150"
          show-overflow-tooltip />
        <el-table-column label="排气法兰处压力 bar(a)" align="center" prop="outletPressureBar" min-width="200"
          show-overflow-tooltip />
        <el-table-column label="排气温度 ℃" align="center" prop="outletTemperature" min-width="150" show-overflow-tooltip />
        <el-table-column label="	静叶角度 °" align="center" prop="statorBladeAngle" min-width="150" show-overflow-tooltip />
        <el-table-column label="工作转速 r/min" align="center" prop="rotationSpeedRpm" min-width="150"
          show-overflow-tooltip />
        <el-table-column label="采集人" align="center" prop="collector" min-width="150" show-overflow-tooltip />
        <el-table-column label="备注" align="center" prop="remark" min-width="150" show-overflow-tooltip />
      </el-table>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="closeAct">确 定</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { getProductInfo } from "@/api/product/productInfo";
export default {
  props: ["openAct", "photoId", "ActTitle", "ActProps"],
  data() {
    return {
      form: {
        tworkingConditionTheoreticalList: [],
        tworkingConditionActualList: [],
      },
    };
  },
  watch: {
    openAct: {
      handler(newVal, oldVal) {
        console.log(this.ActTitle)
        // 处理逻辑
        if (newVal) {
          getProductInfo(this.photoId).then((res) => {
            this.form = res.data;
            this.form.tworkingConditionTheoreticalList = res.data
              .tworkingConditionTheoreticalList
              ? res.data.tworkingConditionTheoreticalList
              : [];


            this.form.tworkingConditionActualList = res.data
              .tworkingConditionActualList
              ? res.data.tworkingConditionActualList
              : [];
          });
        }
      },
      deep: true,
      immediate: true,
    },
  },
  methods: {
    closeAct() {
      this.$emit("closeAct");
    },
  },
};
</script>
